package com.zhj.process.camunda.service.impl;

import com.zhj.process.common.service.AbstractProcessService;
import com.zhj.process.common.service.ProcessRepositoryService;

import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.repository.Deployment;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 仓库服务实现类
 */
@Service
public class RepositoryServiceImpl extends AbstractProcessService<RepositoryService> implements ProcessRepositoryService<Deployment> {

    /**
     * Abstract process service
     *
     * @param service service
     * @since 1.0.0
     */
    public RepositoryServiceImpl(RepositoryService service) {
        super(service);
    }

    /**
     * Gets process definitions *
     *
     * @return the process definitions
     * @since 1.0.0
     */
    @Override
    public List<Deployment> getProcessDefinitions() {
        return this.getService()
            .createDeploymentQuery()
            .listPage(0, 10);
    }
}
